import scrapy


class TcSpider(scrapy.Spider):
    name = "tc"
    allowed_domains = ["sh.58.com"]
    start_urls = [
        "https://sh.58.com/quanzhizhaopin/?key=JAVA%E5%90%8E%E7%AB%AF%E5%BC%80%E5%8F%91%E5%B7%A5%E7%A8%8B%E5%B8%88&classpolicy=strategy%2Cuuid_79ad88337bca404399d180b4bfec4e11%2Cdisplocalid_2%2Cfrom_674%2Cto_jump%2Ctradeline_job%2Cclassify_E&search_uuid=79ad88337bca404399d180b4bfec4e11&final=1"]

    def parse(self, response):
        # 字符串数据
        content = response.text
        print(content)
        # 二进制数据
        body = response.body
        #可以直接使用xpath提取response的内容
        p = response.xpath('//ul[@id="list_con"]/li//div[@class="job_name clearfix"]/a/@href')
        print("==========================")
        print(p.extract())
